home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
CUGUK
/
PROG_TOO
/
C013.ZIP
/
TEST.C
< prev
next >
Wrap
Text File
|
1990-01-19
|
364b
|
23 lines
int test, base;
main() /* RatC example program */
{
test=99;
base=8;
prnum(test,base);
putchar('\n');
}
prnum(num,base) /* print "num" in "base" */
int num,base;
{
int quot,rem;
if (base<2|base>10) return;
if (num<0) {putchar('-'); num= -num; }
quot=num/base;
rem=num%base;
if (quot!=0) prnum(quot,base);
putchar(rem+'0');
}